package com.example.demo.exception;

import com.example.demo.common.enums.MessageStatus;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
public class BusinessException extends RuntimeException {
    private int code;
    private String message;
    private Object data;
    
    public BusinessException(BusinessExceptionStatus businessExceptionStatus) {
        this.code = businessExceptionStatus.value();
        this.message = businessExceptionStatus.message();
    }
    
    public BusinessException(String message) {
        this.code = MessageStatus.ERROR.value();
        this.message = message;
    }
    
    public BusinessException(int code, String message) {
        this.code = code;
        this.message = message;
    }
    
    public BusinessException(BusinessExceptionStatus businessExceptionStatus, String message) {
        this.code = businessExceptionStatus.value();
        this.message = message;
    }
}
